//
//  YYT_TheOffcialTableViewCell.m
//  AudioVisualFeast
//
//  Created by 温晓宇 on 16/1/27.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "YYT_TheOffcialTableViewCell.h"
#import <UIImageView+WebCache.h>
@interface YYT_TheOffcialTableViewCell ()

@property (nonatomic, retain) UIImageView *imageview;
@property (nonatomic, retain) UIImageView *view;
@property (nonatomic, retain) UIImageView *types;
@property (nonatomic, retain) UILabel *title;
@property (nonatomic, retain) UILabel *descriptions;
@property (nonatomic, retain) UIButton *imagebutton;

@end

@implementation YYT_TheOffcialTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self create];
    }
    return self;
}
- (void)create{
    self.imageview = [[UIImageView alloc] initWithFrame:CGRectZero];
    [self addSubview:_imageview];

    self.view = [[UIImageView alloc] initWithFrame:CGRectZero];
    [_imageview addSubview:_view];

    self.types = [[UIImageView alloc] initWithFrame:CGRectZero];
    [_imageview addSubview:_types];

    self.title = [[UILabel alloc] initWithFrame:CGRectZero];
    [_imageview addSubview:_title];
    
    _title.textColor = [UIColor whiteColor];
    _title.font = [UIFont systemFontOfSize:14];

    self.descriptions = [[UILabel alloc] initWithFrame:CGRectZero];
    _descriptions.textColor = [UIColor colorWithRed:30 / 255.0 green:195 / 255.0 blue:153 / 255.0 alpha:1.0];
    [_imageview addSubview:_descriptions];
    _title.font = [UIFont systemFontOfSize:14];

}
-(void)layoutSubviews {
    [super layoutSubviews];
    
    self.imageview.frame = self.bounds;
    self.view.frame = self.bounds;
    self.types.frame = CGRectMake(15, 240, 45, 45);
    self.title.frame = CGRectMake(70, 233, self.bounds.size.width - 70, 46);
    self.descriptions.frame = CGRectMake(70, 255, self.bounds.size.width - 70, 46);
    
}

-(void)setModel:(YYT_TheOffcialModel *)model{
    _model = model;

    [_imageview sd_setImageWithURL:[NSURL URLWithString:_model.posterPic] placeholderImage:[UIImage imageNamed:@"zhanweitu.png"]];
    self.title.text = _model.title;
    self.descriptions.text = _model.descriptions;
    
#pragma mark  各种图片各种cell
    if ([_model.typezzz isEqualToString:@"PLAYLIST"]) {
        self.types.image = [UIImage imageNamed:@"yuedanaaa"];
    } else if ([_model.typezzz isEqualToString:@"VIDEO"]) {
        self.types.image = [UIImage imageNamed:@"shoubo"];
    } else if ([_model.typezzz isEqualToString:@"PROGRAM"] || [_model.typezzz isEqualToString:@"FANART"]) {
        self.types.image = [UIImage imageNamed:@"jiemu"];
    } else if ([_model.typezzz isEqualToString:@"ACTIVITY"]) {
        self.types.image = [UIImage imageNamed:@"huodong"];
    } else if ([_model.typezzz isEqualToString:@"WEEK_MAIN_STAR"]) {
        self.types.image = [UIImage imageNamed:@"star"];
    } else if ([_model.typezzz isEqualToString:@"INVENTORY"]) {
        self.types.image = [UIImage imageNamed:@"zhuanti"];
    }
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
